home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / office german / PROPLUS.WW / PROPLSWW.CAB / AUTHOR.XSL < prev    next >
Extensible Markup Language  |  2006-07-16  |  36KB  |  1,000 lines

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2.  
  3.  
  4. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  5.     xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
  6.     <xsl:output method="xml" encoding="us-ascii"/>
  7.  
  8.  
  9.  
  10.     <xsl:variable name="const_SepNames">
  11.         <xsl:text>; </xsl:text>    
  12.     </xsl:variable>
  13.  
  14.     <xsl:variable name="const_SepLastFirst">
  15.         <xsl:text>, </xsl:text>    
  16.     </xsl:variable>
  17.  
  18.     <xsl:variable name="const_Space">
  19.         <xsl:text> </xsl:text>    
  20.     </xsl:variable>
  21.  
  22.     <xsl:variable name="const_BracketOpen">
  23.         <xsl:text>(</xsl:text>    
  24.     </xsl:variable>
  25.  
  26.     <xsl:variable name="const_BracketClose">
  27.         <xsl:text>)</xsl:text>    
  28.     </xsl:variable>
  29.  
  30.  
  31.  
  32.  
  33.     <xsl:template match="/">
  34.         <xsl:choose>
  35.             <xsl:when test="b:OfficeSortKey">
  36.                 <Key><xsl:text>Author</xsl:text></Key>
  37.             </xsl:when>
  38.  
  39.             <xsl:when test="b:Sources">
  40.                 <xsl:variable name="ListPopulatedWithMain">
  41.                     <xsl:call-template name="populateMain">
  42.                         <xsl:with-param name="Type">b:Sources</xsl:with-param>
  43.                     </xsl:call-template>
  44.                 </xsl:variable>
  45.                 
  46.                 <xsl:variable name="sList">
  47.                     <xsl:call-template name="sortedList">
  48.                         <xsl:with-param name="sourceRoot">
  49.                             <xsl:copy-of select="$ListPopulatedWithMain"/>
  50.                         </xsl:with-param>
  51.                         
  52.                     </xsl:call-template>
  53.                 </xsl:variable>
  54.  
  55.                 
  56.                 
  57.                 <Sources xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
  58.                 <xsl:for-each select="msxsl:node-set($sList)/b:Sources/b:Source">
  59.                     <Source>
  60.                         <xsl:copy-of select="b:Tag"/>
  61.                         <Display>
  62.  
  63.                             <xsl:variable name="display">
  64.  
  65.                                 <xsl:variable name="allAuthors">
  66.                                     <xsl:if test="string-length(b:Author/b:Main/b:Corporate)=0">
  67.                                         <xsl:for-each select="b:Author/b:Main">
  68.                                           <xsl:call-template name="formatPersonsAuthor"/>
  69.                                         </xsl:for-each>
  70.                                     </xsl:if>
  71.                                     <xsl:if test="string-length(b:Author/b:Main/b:Corporate)>0">
  72.                                           <xsl:value-of select="b:Author/b:Main/b:Corporate"/>
  73.                                     </xsl:if>                                        
  74.                                 </xsl:variable>
  75.  
  76.                                 <xsl:value-of select="$allAuthors"/>
  77.  
  78.                                 <xsl:if test="string-length(b:Title) > 0">
  79.                                     <xsl:if test="string-length(normalize-space($allAuthors)) > 0">
  80.                                         <xsl:value-of select="$const_SepNames"/>
  81.                                     </xsl:if>
  82.                                     <xsl:value-of select="b:Title"/>
  83.                                 </xsl:if>
  84.  
  85.                                 <xsl:if test="string-length(b:Year) > 0">
  86.                                     <xsl:value-of select="$const_Space"/>
  87.                                     <xsl:value-of select="$const_BracketOpen"/>
  88.                                     <xsl:value-of select="b:Year"/>
  89.                                     <xsl:value-of select="$const_BracketClose"/>
  90.                                 </xsl:if>
  91.                             </xsl:variable>
  92.                             
  93.                             <xsl:choose>
  94.                                 <xsl:when test="string-length(normalize-space($display))>0">
  95.                                     <xsl:value-of select="$display"/>
  96.                                 </xsl:when>
  97.                                 <xsl:otherwise>
  98.                                     <xsl:value-of select="b:Tag"/>
  99.                                 </xsl:otherwise>
  100.                             </xsl:choose>
  101.                         </Display>
  102.                         <SimpleSearch>
  103.                             <xsl:call-template name="simplesearchSource"/>
  104.                         </SimpleSearch>
  105.                     </Source>
  106.                 </xsl:for-each>
  107.                 </Sources>
  108.             </xsl:when>
  109.         </xsl:choose>
  110.     </xsl:template>
  111.  
  112.     
  113.     <xsl:template name="sortedList">
  114.         <xsl:param name="sourceRoot"/>
  115.         
  116.         <xsl:apply-templates select="msxsl:node-set($sourceRoot)/*">
  117.             
  118.             <xsl:sort select="b:Author/b:Main/b:NameList/b:Person[1]/b:Last" />
  119.             
  120.             <xsl:sort select="b:Author/b:Main/b:NameList/b:Person[1]/b:First" />
  121.             
  122.             <xsl:sort select="b:Author/b:Main/b:NameList/b:Person[1]/b:Middle"/>
  123.             
  124.             <xsl:sort select="b:Title"/>
  125.         </xsl:apply-templates>
  126.         
  127.     </xsl:template>
  128.  
  129.  
  130.     <xsl:template match="*">
  131.         <xsl:element name="{name()}" namespace="{namespace-uri()}">
  132.             <xsl:for-each select="@*">
  133.                 <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
  134.                     <xsl:value-of select="." />
  135.                 </xsl:attribute>
  136.             </xsl:for-each>
  137.             <xsl:apply-templates>        
  138.                 <xsl:sort select="b:Author/b:Main/b:NameList/b:Person[1]/b:Last" />
  139.                 <xsl:sort select="b:Author/b:Main/b:NameList/b:Person[1]/b:First" />
  140.                 <xsl:sort select="b:Title" />
  141.                 <xsl:sort select="b:Year" />
  142.             </xsl:apply-templates>
  143.         </xsl:element>
  144.     </xsl:template>
  145.  
  146.     <xsl:template match="text()">
  147.         <xsl:value-of select="." />
  148.     </xsl:template>
  149.     
  150.     <xsl:template name="populateMain">
  151.         <xsl:param name="Type"/>
  152.         
  153.         <xsl:element name="{$Type}">
  154.             
  155.             <xsl:for-each select="/*[$Type]/b:Source">
  156.                 
  157.                 <xsl:variable name="MostImportantAuthorLocalName">
  158.                     
  159.                     <xsl:call-template name="MainContributors"/>
  160.                 </xsl:variable>
  161.                 <xsl:element name="{'b:Source'}">
  162.           
  163.           <b:Title>
  164.             
  165.             <xsl:if test="string-length(b:Title)>0">
  166.               <xsl:value-of select="b:Title"/>
  167.             </xsl:if>
  168.             
  169.             <xsl:if test="string-length(b:Title)=0">
  170.               <xsl:choose>
  171.                 <xsl:when test="b:SourceType='Book' or
  172.                                 b:SourceType='JournalArticle' or
  173.                                 b:SourceType='ConferenceProceedings' or
  174.                                 b:SourceType='Report' or
  175.                                 b:SourceType='Performance' or
  176.                                 b:SourceType='Film' or
  177.                                 b:SourceType='Patent' or
  178.                                 b:SourceType='Case'">
  179.  
  180.                   <xsl:value-of select="b:ShortTitle"/>
  181.                 </xsl:when>
  182.  
  183.                 <xsl:when test="b:SourceType='BookSection'">
  184.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  185.                   <xsl:variable name="bookTitle" select="b:BookTitle"/>
  186.  
  187.                   <xsl:choose>
  188.                     <xsl:when test="string-length($shortTitle)>0">
  189.                       <xsl:value-of select="$shortTitle"/>
  190.                     </xsl:when>
  191.                     <xsl:when test="string-length($bookTitle)>0">
  192.                       <xsl:value-of select="$bookTitle"/>
  193.                     </xsl:when>
  194.                   </xsl:choose>
  195.  
  196.                 </xsl:when>
  197.  
  198.                 <xsl:when test="b:SourceType='ArticleInAPeriodical'">
  199.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  200.                   <xsl:variable name="periodicalTitle" select="b:PeriodicalTitle"/>
  201.  
  202.                   <xsl:choose>
  203.                     <xsl:when test="string-length($shortTitle)>0">
  204.                       <xsl:value-of select="$shortTitle"/>
  205.                     </xsl:when>
  206.                     <xsl:when test="string-length($periodicalTitle)>0">
  207.                       <xsl:value-of select="$periodicalTitle"/>
  208.                     </xsl:when>
  209.                   </xsl:choose>
  210.                 </xsl:when>
  211.  
  212.                 <xsl:when test="b:SourceType='InternetSite' or
  213.                                 b:SourceType='DocumentFromInternetSite'">
  214.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  215.                   <xsl:variable name="internetSiteTitle" select="b:InternetSiteTitle"/>
  216.  
  217.                   <xsl:choose>
  218.                     <xsl:when test="string-length($shortTitle)>0">
  219.                       <xsl:value-of select="$shortTitle"/>
  220.                     </xsl:when>
  221.                     <xsl:when test="string-length($internetSiteTitle)>0">
  222.                       <xsl:value-of select="$internetSiteTitle"/>
  223.                     </xsl:when>
  224.                   </xsl:choose>
  225.                 </xsl:when>
  226.  
  227.                 <xsl:when test="b:SourceType='ElectronicSource' or
  228.                                 b:SourceType='Art' or
  229.                                 b:SourceType='Misc'">
  230.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  231.                   <xsl:variable name="publicationTitle" select="b:PublicationTitle"/>
  232.  
  233.                   <xsl:choose>
  234.                     <xsl:when test="string-length($shortTitle)>0">
  235.                       <xsl:value-of select="$shortTitle"/>
  236.                     </xsl:when>
  237.                     <xsl:when test="string-length($publicationTitle)>0">
  238.                       <xsl:value-of select="$publicationTitle"/>
  239.                     </xsl:when>
  240.                   </xsl:choose>
  241.                 </xsl:when>
  242.  
  243.                 <xsl:when test="b:SourceType='SoundRecording'">
  244.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  245.                   <xsl:variable name="albumTitle" select="b:AlbumTitle"/>
  246.  
  247.                   <xsl:choose>
  248.                     <xsl:when test="string-length($shortTitle)>0">
  249.                       <xsl:value-of select="$shortTitle"/>
  250.                     </xsl:when>
  251.                     <xsl:when test="string-length($albumTitle)>0">
  252.                       <xsl:value-of select="$albumTitle"/>
  253.                     </xsl:when>
  254.                   </xsl:choose>
  255.                 </xsl:when>
  256.  
  257.                 <xsl:when test="b:SourceType='Interview'">
  258.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  259.  
  260.                   <xsl:variable name="broadcastTitle" select="b:BroadcastTitle"/>
  261.  
  262.                   <xsl:choose>
  263.                     <xsl:when test="string-length($shortTitle)>0">
  264.                       <xsl:value-of select="$shortTitle"/>
  265.                     </xsl:when>
  266.  
  267.                     <xsl:when test="string-length($broadcastTitle)>0">
  268.                       <xsl:value-of select="$broadcastTitle"/>
  269.                     </xsl:when>
  270.  
  271.                   </xsl:choose>
  272.                 </xsl:when>
  273.                 
  274.               </xsl:choose>
  275.             </xsl:if>
  276.           </b:Title>
  277.                     
  278.                     <b:Author>
  279.                         
  280.                         <b:Main>
  281.                             <xsl:if test="string-length(./b:Author/*[local-name()=$MostImportantAuthorLocalName]/b:Corporate)=0">
  282.                                 <b:NameList>
  283.                                     <xsl:for-each select="./b:Author/*[local-name()=$MostImportantAuthorLocalName]/b:NameList/b:Person">
  284.                                         <b:Person>
  285.                                             
  286.                                             <b:Last>
  287.                                                 <xsl:value-of select="./b:Last"/>
  288.                                             </b:Last>
  289.                                             <b:First>
  290.                                                 <xsl:value-of select="./b:First"/>
  291.                                             </b:First>
  292.                                             <b:Middle>
  293.                                                 <xsl:value-of select="./b:Middle"/>
  294.                                             </b:Middle>
  295.                                         </b:Person>
  296.                                     </xsl:for-each>
  297.                                 </b:NameList>
  298.                             </xsl:if>
  299.                             <xsl:if test="string-length(./b:Author/*[local-name()=$MostImportantAuthorLocalName]/b:Corporate)>0">
  300.                                 <b:Corporate>
  301.                                   <xsl:value-of select="./b:Author/*[local-name()=$MostImportantAuthorLocalName]/b:Corporate"/>
  302.                                 </b:Corporate>
  303.                             </xsl:if>
  304.                         </b:Main>
  305.                         <xsl:for-each select="./b:Author/*">
  306.                             
  307.                             <xsl:if test="name()!='b:Main'">
  308.                                 <xsl:element name="{name()}" namespace="{namespace-uri()}">
  309.                                     <xsl:call-template name="copyNameNodes"/>
  310.                                     
  311.                                 </xsl:element>
  312.                             </xsl:if>
  313.                         </xsl:for-each>
  314.                     </b:Author>
  315.                     <xsl:for-each select="*">
  316.                         
  317.                         <xsl:if test="name()!='b:Author' and name()!='b:Title'">
  318.                             <xsl:element name="{name()}" namespace="{namespace-uri()}">
  319.                                 <xsl:call-template name="copyNodes"/>
  320.                                 
  321.                             </xsl:element>
  322.                         </xsl:if>
  323.                     </xsl:for-each>
  324.                 </xsl:element>
  325.             </xsl:for-each>
  326.             <xsl:for-each select="/*[$Type]/*">
  327.                 
  328.                 <xsl:if test="local-name()!='Source'">
  329.                     <xsl:call-template name="copyTrees"/>
  330.                 </xsl:if>
  331.             </xsl:for-each>
  332.         </xsl:element>
  333.     </xsl:template>
  334.     
  335.     
  336.     
  337.     <xsl:template name="MainContributors">
  338.         <xsl:param name="SourceRoot"/>
  339.         <xsl:choose>
  340.             <xsl:when test="./b:SourceType='Book'">
  341.                 <xsl:choose>
  342.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  343.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  344.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  345.                 </xsl:choose>
  346.             </xsl:when>
  347.  
  348.             <xsl:when test="./b:SourceType='BookSection'">
  349.                 <xsl:choose>
  350.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  351.                     <xsl:when test="string-length(./b:Author/b:BookAuthor)>0">BookAuthor</xsl:when>
  352.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  353.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  354.                 </xsl:choose>
  355.             </xsl:when>
  356.  
  357.             <xsl:when test="./b:SourceType='JournalArticle'">
  358.                 <xsl:choose>
  359.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  360.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  361.                 </xsl:choose>
  362.             </xsl:when>
  363.  
  364.             <xsl:when test="./b:SourceType='ArticleInAPeriodical'">
  365.                 <xsl:choose>
  366.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  367.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  368.                 </xsl:choose>
  369.             </xsl:when>
  370.  
  371.             <xsl:when test="./b:SourceType='ConferenceProceedings'">
  372.                 <xsl:choose>
  373.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  374.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  375.                 </xsl:choose>
  376.             </xsl:when>
  377.  
  378.             <xsl:when test="./b:SourceType='Report'">
  379.                 <xsl:choose>
  380.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  381.                 </xsl:choose>
  382.             </xsl:when>
  383.  
  384.             <xsl:when test="./b:SourceType='SoundRecording'">
  385.                 <xsl:choose>
  386.                     <xsl:when test="string-length(./b:Author/b:Performer)>0">Performer</xsl:when>
  387.                     <xsl:when test="string-length(./b:Author/b:Artist)>0">Artist</xsl:when>
  388.                     <xsl:when test="string-length(./b:Author/b:Composer)>0">Composer</xsl:when>
  389.                     <xsl:when test="string-length(./b:Author/b:Conductor)>0">Conductor</xsl:when>
  390.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  391.                 </xsl:choose>
  392.             </xsl:when>
  393.  
  394.             <xsl:when test="./b:SourceType='Performance'">
  395.                 <xsl:choose>
  396.                     <xsl:when test="string-length(./b:Author/b:Writer)>0">Writer</xsl:when>
  397.                     <xsl:when test="string-length(./b:Author/b:Performer)>0">Performer</xsl:when>
  398.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  399.                     <xsl:when test="string-length(./b:Author/b:Director)>0">Director</xsl:when>
  400.                 </xsl:choose>
  401.             </xsl:when>
  402.  
  403.             <xsl:when test="./b:SourceType='Art'">
  404.                 <xsl:choose>
  405.                     <xsl:when test="string-length(./b:Author/b:Artist)>0">Artist</xsl:when>
  406.                 </xsl:choose>
  407.             </xsl:when>
  408.  
  409.             <xsl:when test="./b:SourceType='DocumentFromInternetSite'">
  410.                 <xsl:choose>
  411.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  412.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  413.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  414.                 </xsl:choose>
  415.             </xsl:when>
  416.  
  417.             <xsl:when test="./b:SourceType='InternetSite'">
  418.                 <xsl:choose>
  419.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  420.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  421.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  422.                 </xsl:choose>
  423.             </xsl:when>
  424.  
  425.             <xsl:when test="./b:SourceType='Film'">
  426.                 <xsl:choose>
  427.                     <xsl:when test="string-length(./b:Author/b:Writer)>0">Writer</xsl:when>
  428.                     <xsl:when test="string-length(./b:Author/b:Performer)>0">Performer</xsl:when>
  429.                     <xsl:when test="string-length(./b:Author/b:Director)>0">Director</xsl:when>
  430.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  431.                 </xsl:choose>
  432.             </xsl:when>
  433.  
  434.             <xsl:when test="./b:SourceType='Interview'">
  435.                 <xsl:choose>
  436.                     <xsl:when test="string-length(./b:Author/b:Interviewee)>0">Interviewee</xsl:when>
  437.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  438.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  439.                     <xsl:when test="string-length(./b:Author/b:Interviewer)>0">Interviewer</xsl:when>
  440.                     <xsl:when test="string-length(./b:Author/b:Compiler)>0">Compiler</xsl:when>
  441.                 </xsl:choose>
  442.             </xsl:when>
  443.  
  444.             <xsl:when test="./b:SourceType='Patent'">
  445.                 <xsl:choose>
  446.                     <xsl:when test="string-length(./b:Author/b:Inventor)>0">Inventor</xsl:when>
  447.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  448.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  449.                 </xsl:choose>
  450.             </xsl:when>
  451.  
  452.             <xsl:when test="./b:SourceType='ElectronicSource'">
  453.                 <xsl:choose>
  454.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  455.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  456.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  457.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  458.                 </xsl:choose>
  459.             </xsl:when>
  460.  
  461.             <xsl:when test="./b:SourceType='Case'">
  462.                 <xsl:choose>
  463.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  464.                     <xsl:when test="string-length(./b:Author/b:Counsel)>0">Counsel</xsl:when>
  465.                 </xsl:choose>
  466.             </xsl:when>
  467.  
  468.             <xsl:when test="./b:SourceType='Misc'">
  469.                 <xsl:choose>
  470.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  471.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  472.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  473.                     <xsl:when test="string-length(./b:Author/b:Compiler)>0">Compiler</xsl:when>
  474.                 </xsl:choose>
  475.             </xsl:when>
  476.         </xsl:choose>
  477.     </xsl:template>
  478.  
  479.     <xsl:template name="copyNameNodes">
  480.         <xsl:if test="string-length(b:Corporate)=0">
  481.             <b:NameList>
  482.                 <xsl:for-each select="b:NameList/b:Person">
  483.                     
  484.                     <b:Person>
  485.                         
  486.                         <xsl:if test="string-length(./b:Last)>0">
  487.                             
  488.                             <b:Last>
  489.                                 <xsl:value-of select="./b:Last"/>
  490.                             </b:Last>
  491.                         </xsl:if>
  492.                         <xsl:if test="string-length(./b:First)>0">
  493.                             <b:First>
  494.                                 <xsl:value-of select="./b:First"/>
  495.                             </b:First>
  496.                         </xsl:if>
  497.                         <xsl:if test="string-length(./b:Middle)">
  498.                             <b:Middle>
  499.                                 <xsl:value-of select="./b:Middle"/>
  500.                             </b:Middle>
  501.                         </xsl:if>
  502.                     </b:Person>
  503.                 </xsl:for-each>
  504.             </b:NameList>
  505.         </xsl:if>
  506.         <xsl:if test="string-length(b:Corporate)>0">
  507.             <b:Corporate>
  508.               <xsl:value-of select="b:Corporate"/>
  509.             </b:Corporate>
  510.         </xsl:if>
  511.     </xsl:template>
  512.  
  513.  
  514.     <xsl:template name="copyNodes">
  515.         <xsl:value-of select="."/>
  516.     </xsl:template>
  517.  
  518.  
  519.     <xsl:template name="copyTrees">
  520.         <xsl:copy-of select ='.'/>
  521.     </xsl:template>
  522.  
  523.     <xsl:template name="simplesearchField">
  524.         <xsl:choose>
  525.             <xsl:when test="local-name()='Guid'"/>
  526.             <xsl:when test="local-name()='RefOrder'"/>
  527.             <xsl:when test="local-name()='SourceType'"/>
  528.             <xsl:otherwise>
  529.                 <xsl:value-of select="." /><xsl:text> </xsl:text>
  530.             </xsl:otherwise>
  531.         </xsl:choose>
  532.  
  533.         <xsl:for-each select="*">
  534.                 <xsl:call-template name="simplesearchField"/>
  535.         </xsl:for-each>
  536.     </xsl:template>
  537.  
  538.     <xsl:template name="simplesearchSource">
  539.         <xsl:for-each select="*">
  540.             <xsl:call-template name="simplesearchField"/>
  541.         </xsl:for-each>
  542.     </xsl:template>
  543.  
  544.   <xsl:template name="formatIntervieweeLfmSku">
  545.     <xsl:for-each select="b:Author/b:Interviewee">
  546.       <xsl:call-template name="formatPersonsAuthor"/>
  547.     </xsl:for-each>
  548.   </xsl:template>
  549.  
  550.   <xsl:template name="formatInterviewerLfmSku">
  551.     <xsl:for-each select="b:Author/b:Interviewer">
  552.       <xsl:call-template name="formatPersonsAuthor"/>
  553.     </xsl:for-each>
  554.   </xsl:template>
  555.  
  556.   <xsl:template name="formatPersonsAuthor">
  557.     <xsl:if test="string-length(b:Corporate)=0">
  558.         <xsl:for-each select="b:NameList/b:Person">
  559.           <xsl:if test="6 >= position()">
  560.             <xsl:call-template name="formatMainAuthor"/>
  561.           </xsl:if>
  562.           <xsl:call-template name="formatPersonSeperatorMain"/>
  563.         </xsl:for-each>
  564.     </xsl:if>
  565.     <xsl:if test="string-length(b:Corporate)>0">
  566.       <xsl:value-of select="b:Corporate"/>
  567.     </xsl:if>
  568.   </xsl:template>
  569.  
  570.   <xsl:template name="formatMainAuthor">
  571.     <xsl:call-template name="formatNameCore">
  572.       <xsl:with-param name="FML">
  573.         <xsl:call-template name="templ_prop_Authors_FML"/>
  574.       </xsl:with-param>
  575.       <xsl:with-param name="FM">
  576.         <xsl:call-template name="templ_prop_Authors_FM"/>
  577.       </xsl:with-param>
  578.       <xsl:with-param name="ML">
  579.         <xsl:call-template name="templ_prop_Authors_ML"/>
  580.       </xsl:with-param>
  581.       <xsl:with-param name="FL">
  582.         <xsl:call-template name="templ_prop_Authors_FL"/>
  583.       </xsl:with-param>
  584.       <xsl:with-param name="upperLast">no</xsl:with-param>
  585.       <xsl:with-param name="withDot">yes</xsl:with-param>
  586.  
  587.     </xsl:call-template>
  588.   </xsl:template>
  589.  
  590.   <xsl:template name="formatPersonSeperatorMain">
  591.     <xsl:param name="isLast"/>
  592.  
  593.     <xsl:choose>
  594.       <xsl:when test="6 >= count(../b:Person) and position() = count(../b:Person) - 1">
  595.         <xsl:call-template name="templ_prop_AuthorsSeparator"/>
  596.         <xsl:if test="string-length($isLast)=0 or $isLast=true()">
  597.           <xsl:call-template name="templ_prop_Space"/>
  598.         </xsl:if>
  599.       </xsl:when>
  600.       <xsl:when test="6 > position() and position() != count(../b:Person)">
  601.         <xsl:call-template name="templ_prop_AuthorsSeparator"/>
  602.       </xsl:when>
  603.       <xsl:when test="count(../b:Person) > 6 and position() = count(../b:Person)">
  604.         <xsl:call-template name="templ_prop_AuthorsSeparator"/>
  605.         <xsl:call-template name="templ_str_AndOthersUnCap"/>
  606.       </xsl:when>
  607.       <xsl:when test="position()>6">
  608.       </xsl:when>
  609.     </xsl:choose>
  610.   </xsl:template>
  611.  
  612.   <xsl:template name="formatNameCore">
  613.     <xsl:param name="FML"/>
  614.     <xsl:param name="FM"/>
  615.     <xsl:param name="ML"/>
  616.     <xsl:param name="FL"/>
  617.     <xsl:param name="upperLast"/>
  618.     <xsl:param name="withDot"/>
  619.  
  620.     <xsl:variable name="first">
  621.       <xsl:call-template name="handleSpaces">
  622.         <xsl:with-param name="field" select="b:First"/>
  623.       </xsl:call-template>
  624.     </xsl:variable>
  625.  
  626.     <xsl:variable name="middle">
  627.       <xsl:call-template name="handleSpaces">
  628.         <xsl:with-param name="field" select="b:Middle"/>
  629.       </xsl:call-template>
  630.     </xsl:variable>
  631.  
  632.     <xsl:variable name="last">
  633.       <xsl:call-template name="handleSpaces">
  634.         <xsl:with-param name="field" select="b:Last"/>
  635.       </xsl:call-template>
  636.     </xsl:variable>
  637.  
  638.     <xsl:variable name="format">
  639.       <xsl:choose>
  640.         <xsl:when test="string-length($first) = 0 and string-length($middle) = 0 and string-length($last) = 0 ">
  641.         </xsl:when>
  642.         <xsl:when test="string-length($first) = 0 and string-length($middle) = 0 and string-length($last) != 0 ">
  643.           <xsl:text>%L</xsl:text>
  644.         </xsl:when>
  645.         <xsl:when test="string-length($first) = 0 and string-length($middle) != 0 and string-length($last) = 0 ">
  646.           <xsl:text>%M</xsl:text>
  647.         </xsl:when>
  648.         <xsl:when test="string-length($first) = 0 and string-length($middle) != 0 and string-length($last) != 0 ">
  649.           <xsl:value-of select="$ML"/>
  650.         </xsl:when>
  651.         <xsl:when test="string-length($first) != 0 and string-length($middle) = 0 and string-length($last) = 0 ">
  652.           <xsl:text>%F</xsl:text>
  653.         </xsl:when>
  654.         <xsl:when test="string-length($first) != 0 and string-length($middle) = 0 and string-length($last) != 0 ">
  655.           <xsl:value-of select="$FL"/>
  656.         </xsl:when>
  657.         <xsl:when test="string-length($first) != 0 and string-length($middle) != 0 and string-length($last) = 0 ">
  658.           <xsl:value-of select="$FM"/>
  659.         </xsl:when>
  660.         <xsl:when test="string-length($first) != 0 and string-length($middle) != 0 and string-length($last) != 0 ">
  661.           <xsl:value-of select="$FML"/>
  662.         </xsl:when>
  663.       </xsl:choose>
  664.     </xsl:variable>
  665.  
  666.     <xsl:call-template name="StringFormatName">
  667.       <xsl:with-param name="format" select="$format"/>
  668.       <xsl:with-param name="upperLast" select="$upperLast"/>
  669.       <xsl:with-param name="withDot" select="$withDot"/>
  670.     </xsl:call-template>
  671.  
  672.   </xsl:template>
  673.  
  674.   <xsl:template name="StringFormatName">
  675.     <xsl:param name="format" />
  676.     <xsl:param name="withDot" />
  677.     <xsl:param name="upperLast"/>
  678.  
  679.     <xsl:variable name="prop_EndChars">
  680.       <xsl:call-template name="templ_prop_EndChars"/>
  681.     </xsl:variable>
  682.  
  683.     <xsl:choose>
  684.       <xsl:when test="$format = ''"></xsl:when>
  685.       <xsl:when test="substring($format, 1, 2) = '%%'">
  686.         <xsl:text>%</xsl:text>
  687.         <xsl:call-template name="StringFormatName">
  688.           <xsl:with-param name="format" select="substring($format, 3)" />
  689.           <xsl:with-param name="withDot" select="$withDot" />
  690.           <xsl:with-param name="upperLast" select="$upperLast" />
  691.         </xsl:call-template>
  692.  
  693.         <xsl:if test="string-length($format)=2 and withDot = 'yes' and not(contains($prop_EndChars, '%'))">
  694.           <xsl:call-template name="templ_prop_Dot"/>
  695.         </xsl:if>
  696.       </xsl:when>
  697.       <xsl:when test="substring($format, 1, 1) = '%'">
  698.         <xsl:variable name="what" select="substring($format, 2, 1)" />
  699.  
  700.         <xsl:choose>
  701.           <xsl:when test="(what = 'l' or what = 'L') and upperLast = 'yes'">
  702.             <span style='text-transform: uppercase;'>
  703.               <xsl:call-template name="formatNameOneItem">
  704.                 <xsl:with-param name="format" select="$what"/>
  705.               </xsl:call-template>
  706.             </span>
  707.           </xsl:when>
  708.           <xsl:otherwise>
  709.             <xsl:call-template name="formatNameOneItem">
  710.               <xsl:with-param name="format" select="$what"/>
  711.             </xsl:call-template>
  712.           </xsl:otherwise>
  713.         </xsl:choose>
  714.         <xsl:call-template name="StringFormatName">
  715.           <xsl:with-param name="format" select="substring($format, 3)" />
  716.           <xsl:with-param name="withDot" select="$withDot" />
  717.           <xsl:with-param name="upperLast" select="$upperLast" />
  718.         </xsl:call-template>
  719.         <xsl:if test="string-length($format)=2 and withDot='yes'">
  720.           <xsl:variable name="temp2">
  721.             <xsl:call-template name="handleSpaces">
  722.               <xsl:with-param name="field">
  723.                 <xsl:call-template name="formatNameOneItem">
  724.                   <xsl:with-param name="format" select="$what"/>
  725.                 </xsl:call-template>
  726.               </xsl:with-param>
  727.             </xsl:call-template>
  728.           </xsl:variable>
  729.           <xsl:variable name="lastChar">
  730.             <xsl:value-of select="substring($temp2, string-length($temp2))"/>
  731.           </xsl:variable>
  732.           <xsl:if test="not(contains($prop_EndChars, $lastChar))">
  733.             <xsl:call-template name="templ_prop_Dot"/>
  734.           </xsl:if>
  735.         </xsl:if>
  736.       </xsl:when>
  737.       <xsl:otherwise>
  738.         <xsl:value-of select="substring($format, 1, 1)" />
  739.         <xsl:call-template name="StringFormatName">
  740.           <xsl:with-param name="format" select="substring($format, 2)" />
  741.           <xsl:with-param name="withDot" select="$withDot" />
  742.           <xsl:with-param name="upperLast" select="$upperLast" />
  743.         </xsl:call-template>
  744.         <xsl:if test="string-length($format)=1">
  745.           <xsl:if test="withDot = 'yes' and not(contains($prop_EndChars, $format))">
  746.             <xsl:call-template name="templ_prop_Dot"/>
  747.           </xsl:if>
  748.         </xsl:if>
  749.       </xsl:otherwise>
  750.     </xsl:choose>
  751.   </xsl:template>
  752.  
  753.   <xsl:template name="formatNameOneItem">
  754.     <xsl:param name="format"/>
  755.  
  756.     <xsl:choose>
  757.       <xsl:when test="$format = 'F'">
  758.         <xsl:value-of select="b:First"/>
  759.       </xsl:when>
  760.       <xsl:when test="$format = 'L'">
  761.         <xsl:value-of select="b:Last"/>
  762.       </xsl:when>
  763.       <xsl:when test="$format = 'M'">
  764.         <xsl:value-of select="b:Middle"/>
  765.       </xsl:when>
  766.       <xsl:when test="$format = 'f'">
  767.         <xsl:call-template name="formatNameInitial">
  768.           <xsl:with-param name="name" select="b:First"/>
  769.         </xsl:call-template>
  770.       </xsl:when>
  771.       <xsl:when test="$format = 'm'">
  772.         <xsl:call-template name="formatNameInitial">
  773.           <xsl:with-param name="name" select="b:Middle"/>
  774.         </xsl:call-template>
  775.       </xsl:when>
  776.       <xsl:when test="$format = 'l'">
  777.         <xsl:call-template name="formatNameInitial">
  778.           <xsl:with-param name="name" select="b:Last"/>
  779.         </xsl:call-template>
  780.       </xsl:when>
  781.     </xsl:choose>
  782.  
  783.   </xsl:template>
  784.  
  785.   <xsl:template name="formatNameInitial">
  786.     <xsl:param name="name"/>
  787.     <xsl:variable name="temp">
  788.       <xsl:call-template name="handleSpaces">
  789.         <xsl:with-param name="field" select="$name"/>
  790.       </xsl:call-template>
  791.     </xsl:variable>
  792.  
  793.     <xsl:variable name="prop_APA_Hyphens">
  794.       <xsl:call-template name="templ_prop_Hyphens"/>
  795.     </xsl:variable>
  796.  
  797.     <xsl:if test="string-length($temp)>0">
  798.  
  799.       <xsl:variable name="tempWithoutSpaces">
  800.         <xsl:value-of select="translate($temp, '  ', '')"/>
  801.         
  802.       </xsl:variable>
  803.  
  804.       <xsl:if test="not(contains($prop_APA_Hyphens, substring($tempWithoutSpaces, 1, 1)))">
  805.         <xsl:value-of select="substring($tempWithoutSpaces, 1, 1)"/>
  806.         <xsl:call-template name="templ_prop_DotInitial"/>
  807.       </xsl:if>
  808.  
  809.       <xsl:call-template name="handleHyphens">
  810.         <xsl:with-param name="name" select="$tempWithoutSpaces"/>
  811.       </xsl:call-template>
  812.     </xsl:if>
  813.   </xsl:template>
  814.  
  815.   <xsl:template name="handleHyphens">
  816.     <xsl:param name="name"/>
  817.  
  818.     <xsl:variable name="prop_APA_Hyphens">
  819.       <xsl:call-template name="templ_prop_Hyphens"/>
  820.     </xsl:variable>
  821.  
  822.     <xsl:if test="string-length($name)>=2">
  823.       <xsl:choose>
  824.         <xsl:when test="contains($prop_APA_Hyphens, substring($name, 1, 1))">
  825.           <xsl:value-of select="substring($name, 1, 2)"/>
  826.           <xsl:call-template name="templ_prop_DotInitial"/>
  827.  
  828.           <xsl:call-template name="handleHyphens">
  829.             <xsl:with-param name="name" select="substring($name, 3)"/>
  830.           </xsl:call-template>
  831.         </xsl:when>
  832.  
  833.         <xsl:otherwise>
  834.           <xsl:call-template name="handleHyphens">
  835.             <xsl:with-param name="name" select="substring($name, 2)"/>
  836.           </xsl:call-template>
  837.         </xsl:otherwise>
  838.       </xsl:choose>
  839.  
  840.     </xsl:if>
  841.  
  842.   </xsl:template>
  843.  
  844.   <xsl:template name="handleSpaces">
  845.     <xsl:param name="field"/>
  846.  
  847.     <xsl:variable name="prop_NormalizeSpace">
  848.       <xsl:call-template name="templ_prop_NormalizeSpace"/>
  849.     </xsl:variable>
  850.  
  851.     <xsl:choose>
  852.       <xsl:when test="$prop_NormalizeSpace='yes'">
  853.         <xsl:value-of select="normalize-space($field)"/>
  854.       </xsl:when>
  855.       <xsl:otherwise>
  856.         <xsl:value-of select="$field"/>
  857.       </xsl:otherwise>
  858.     </xsl:choose>
  859.   </xsl:template>
  860.  
  861.   <xsl:template name="localLCID">
  862.     <xsl:value-of select="/*/b:Locals/b:DefaultLCID"/>
  863.   </xsl:template>
  864.  
  865.   
  866.   <xsl:template name="templ_prop_NormalizeSpace" >
  867.     <xsl:param name="LCID" />
  868.     <xsl:variable name="_LCID">
  869.       <xsl:call-template name="localLCID">
  870.         <xsl:with-param name="LCID" select="$LCID"/>
  871.       </xsl:call-template>
  872.     </xsl:variable>
  873.     <xsl:text>no</xsl:text>
  874.     
  875.   </xsl:template>
  876.  
  877.   
  878.   <xsl:template name="templ_prop_AuthorsSeparator" >
  879.     <xsl:param name="LCID" />
  880.     <xsl:variable name="_LCID">
  881.       <xsl:call-template name="localLCID">
  882.         <xsl:with-param name="LCID" select="$LCID"/>
  883.       </xsl:call-template>
  884.     </xsl:variable>
  885.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:AuthorsSeparator"/>
  886.   </xsl:template>
  887.  
  888.   
  889.   <xsl:template name="templ_prop_Space" >
  890.     <xsl:param name="LCID" />
  891.     <xsl:variable name="_LCID">
  892.       <xsl:call-template name="localLCID">
  893.         <xsl:with-param name="LCID" select="$LCID"/>
  894.       </xsl:call-template>
  895.     </xsl:variable>
  896.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:Space"/>
  897.   </xsl:template>
  898.  
  899.   
  900.   <xsl:template name="templ_str_AndOthersUnCap" >
  901.     <xsl:param name="LCID" />
  902.     <xsl:variable name="_LCID">
  903.       <xsl:call-template name="localLCID">
  904.         <xsl:with-param name="LCID" select="$LCID"/>
  905.       </xsl:call-template>
  906.     </xsl:variable>
  907.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Strings/b:AndOthersUnCap"/>
  908.   </xsl:template>
  909.  
  910.   
  911.   <xsl:template name="templ_prop_EndChars" >
  912.     <xsl:param name="LCID" />
  913.     <xsl:variable name="_LCID">
  914.       <xsl:call-template name="localLCID">
  915.         <xsl:with-param name="LCID" select="$LCID"/>
  916.       </xsl:call-template>
  917.     </xsl:variable>
  918.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:EndChars"/>
  919.   </xsl:template>
  920.  
  921.   
  922.   <xsl:template name="templ_prop_Dot" >
  923.     <xsl:param name="LCID" />
  924.     <xsl:variable name="_LCID">
  925.       <xsl:call-template name="localLCID">
  926.         <xsl:with-param name="LCID" select="$LCID"/>
  927.       </xsl:call-template>
  928.     </xsl:variable>
  929.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:Dot"/>
  930.   </xsl:template>
  931.  
  932.   
  933.   <xsl:template name="templ_prop_Authors_FML" >
  934.     <xsl:param name="LCID" />
  935.     <xsl:variable name="_LCID">
  936.       <xsl:call-template name="localLCID">
  937.         <xsl:with-param name="LCID" select="$LCID"/>
  938.       </xsl:call-template>
  939.     </xsl:variable>
  940.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:FML"/>
  941.   </xsl:template>
  942.  
  943.   
  944.   <xsl:template name="templ_prop_Authors_FM" >
  945.     <xsl:param name="LCID" />
  946.     <xsl:variable name="_LCID">
  947.       <xsl:call-template name="localLCID">
  948.         <xsl:with-param name="LCID" select="$LCID"/>
  949.       </xsl:call-template>
  950.     </xsl:variable>
  951.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:FM"/>
  952.   </xsl:template>
  953.  
  954.   
  955.   <xsl:template name="templ_prop_Authors_ML" >
  956.     <xsl:param name="LCID" />
  957.     <xsl:variable name="_LCID">
  958.       <xsl:call-template name="localLCID">
  959.         <xsl:with-param name="LCID" select="$LCID"/>
  960.       </xsl:call-template>
  961.     </xsl:variable>
  962.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:ML"/>
  963.   </xsl:template>
  964.  
  965.   
  966.   <xsl:template name="templ_prop_Authors_FL" >
  967.     <xsl:param name="LCID" />
  968.     <xsl:variable name="_LCID">
  969.       <xsl:call-template name="localLCID">
  970.         <xsl:with-param name="LCID" select="$LCID"/>
  971.       </xsl:call-template>
  972.     </xsl:variable>
  973.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:FL"/>
  974.   </xsl:template>
  975.  
  976.   
  977.   <xsl:template name="templ_prop_Hyphens" >
  978.     <xsl:param name="LCID" />
  979.     <xsl:variable name="_LCID">
  980.       <xsl:call-template name="localLCID">
  981.         <xsl:with-param name="LCID" select="$LCID"/>
  982.       </xsl:call-template>
  983.     </xsl:variable>
  984.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:Hyphens"/>
  985.   </xsl:template>
  986.  
  987.   
  988.   <xsl:template name="templ_prop_DotInitial" >
  989.     <xsl:param name="LCID" />
  990.     <xsl:variable name="_LCID">
  991.       <xsl:call-template name="localLCID">
  992.         <xsl:with-param name="LCID" select="$LCID"/>
  993.       </xsl:call-template>
  994.     </xsl:variable>
  995.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:DotInitial"/>
  996.   </xsl:template>
  997.  
  998. </xsl:stylesheet>
  999.  
  1000.